<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
  <meta name="description" content="API docs for the doExecute method from the FileCommand class, for the Dart programming language.">
  <title>doExecute method - FileCommand class - file_command library - Dart API</title>


  
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  
  <link rel="stylesheet" href="../../static-assets/github.css?v1">
  <link rel="stylesheet" href="../../static-assets/styles.css?v1">
  <link rel="icon" href="../../static-assets/favicon.png?v1">

  
</head>


<body data-base-href="../../" data-using-base-href="false">

<div id="overlay-under-drawer"></div>

<header id="title">
  <button id="sidenav-left-toggle" type="button">&nbsp;</button>
  <ol class="breadcrumbs gt-separated dark hidden-xs">
    <li><a href="../../index.html">cli_time</a></li>
    <li><a href="../../shell_file_command/shell_file_command-library.html">file_command</a></li>
    <li><a href="../../shell_file_command/FileCommand-class.html">FileCommand</a></li>
    <li class="self-crumb">doExecute method</li>
  </ol>
  <div class="self-name">doExecute</div>
  <form class="search navbar-right" role="search">
    <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<main>


  <div id="dartdoc-main-content" class="main-content">
      <div>
<h1><span class="kind-method">doExecute</span> method 
    <a href="https://dart.dev/null-safety" class="feature feature-null-safety" title="Supports the null safety language feature.">Null safety</a>
</h1></div>

    <section class="multi-line-signature">
      
<div>
  <ol class="annotation-list">
    <li>@<a href="https://api.flutter.dev/flutter/dart-core/override-constant.html">override</a></li>
  </ol>
</div>

<span class="returntype"><a href="https://api.flutter.dev/flutter/dart-async/Future-class.html">Future</a></span>
<span class="name ">doExecute</span>(<wbr>)

      <div class="features">override</div>

    </section>
    


    
<section class="summary source-code" id="source">
  <h2><span>Implementation</span></h2>
  <pre class="language-dart"><code class="language-dart">@override
Future doExecute() async {
  &#47;&#47; 定义要进入的目录和要执行的脚本
  String argPath = args[ArgsVal.project];

  String fileType = args[ArgsVal.fileType];
  String path = Directory.current.path;

  String sourceDir = &quot;$path&#47;sh&quot;;
  String sourceSh = &quot;$path&#47;sh&#47;my.sh&quot;;

  String logType = &quot;$path&#47;sh&#47;log$fileType&quot;;

  print(&quot;创建文件$sourceDir&quot;);
  if (!Directory(sourceDir).existsSync()) {
    Directory(sourceDir).createSync();
  }

  print(&quot;创建文件$sourceSh&quot;);
  await FileUtil.writeText(sourceSh, &quot;&quot;&quot;#!&#47;bin&#47;sh \n # 记录一下开始时间 \necho &quot;&#47;&#47;&quot;+ `date` &gt;&gt; log$fileType \necho &#39;&#47;&#47;finish&#39; &gt;&gt; log$fileType&quot;&quot;&quot;);
  print(&quot;创建文件$logType&quot;);
  await FileUtil.writeText(logType, &quot;&quot;);

  String destDirectory = argPath;
  String destDir = &quot;$destDirectory&#47;sh&quot;;
  if (!Directory(destDir).existsSync()) {
    Directory(destDir).createSync();
  }
  print(&quot;创建文件$destDir&quot;);
  await FileUtil.copyDirectory(sourceDir, destDir);
  print(&quot;创建文件$logType&quot;);
  print(path);
}</code></pre>
</section>


  </div> <!-- /.main-content -->

  <div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left">
    <header id="header-search-sidebar" class="hidden-l">
  <form class="search-sidebar" role="search">
    <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
  <li><a href="../../index.html">cli_time</a></li>
  <li><a href="../../shell_file_command/shell_file_command-library.html">file_command</a></li>
  <li><a href="../../shell_file_command/FileCommand-class.html">FileCommand</a></li>
  <li class="self-crumb">doExecute method</li>
</ol>


    <h5>FileCommand class</h5>
    <ol>

        <li class="section-title"><a href="../../shell_file_command/FileCommand-class.html#constructors">Constructors</a></li>
          <li><a href="../../shell_file_command/FileCommand/FileCommand.html">FileCommand</a></li>


    <li class="section-title">
      <a href="../../shell_file_command/FileCommand-class.html#instance-properties">Properties</a>
    </li>
    <li class="inherited"><a href="../../shell_basic_shell/BasicShell/args.html">args</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/hashCode.html">hashCode</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html">runtimeType</a></li>
    <li><a href="../../shell_file_command/FileCommand/shell.html">shell</a></li>

    <li class="section-title"><a href="../../shell_file_command/FileCommand-class.html#instance-methods">Methods</a></li>
    <li><a href="../../shell_file_command/FileCommand/doExecute.html">doExecute</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/toString.html">toString</a></li>

    <li class="section-title inherited"><a href="../../shell_file_command/FileCommand-class.html#operators">Operators</a></li>
    <li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html">operator ==</a></li>




</ol>

  </div><!--/.sidebar-offcanvas-->

  <div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
  </div><!--/.sidebar-offcanvas-->

</main>

<footer>
  <span class="no-break">
    cli_time
      1.0.0
  </span>

  
</footer>



<script src="../../static-assets/highlight.pack.js?v1"></script>
<script src="../../static-assets/docs.dart.js"></script>



</body>

</html>

